import sysParam from '@/common/sysParam';

export function getStorageBykey(key) {
  return localStorage.getItem(`${sysParam.sysName}-${key}`);
}

export function saveStorage(data) {
  Object.keys(data).forEach(key => {
    let value = data[key];
    if (value) {
      if (typeof value === 'object') {
        value = JSON.stringify(value);
      }
      localStorage.setItem(`${sysParam.sysName}-${key}`, value);
    }
  });
}
